package com.ruicar.afs.cloud.archive.feign;

import com.alibaba.fastjson.JSONObject;
import com.ruicar.afs.cloud.archive.dto.*;
import com.ruicar.afs.cloud.archive.result.ArchivedResultDto;
import com.ruicar.afs.cloud.common.core.feign.AfsFeignFormSupport;
import com.ruicar.afs.cloud.common.core.feign.annotations.AfsFeignClear;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * @description: 对接归档系统
 * @author: sijun.yu
 * @date: 2020/6/5 11:48
 */
@FeignClient(name = "archive", url = "${com.greatwall.systems.archive-system.url}", configuration = AfsFeignFormSupport.class)
public interface ArchiveApiFeign {

    /**
     * 获取单个经销商超期信息
     *
     * @param dto
     * @return
     */
    @ApiOperation("获取单个经销商超期信息")
    @PostMapping(value = "/S22001/overdue/singledealer")
    @AfsFeignClear(true)
    ArchivedResultDto getSingleDealer(@RequestBody DealerDto dto);

    /**
     * 延期申请-延期列表
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("延期列表")
    @PostMapping(value = "/S22001/delay/getlist")
    @AfsFeignClear(true)
    ArchivedResultDto getDelayList(@RequestBody DelayDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 延期申请-提交申请和暂存
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("提交申请和暂存")
    @PostMapping(value = "/S22001/delay/submit")
    @AfsFeignClear(true)
    ArchivedResultDto submitDelay(@RequestBody DelayDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 申请延期申请
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("申请延期申请，申请编号延期类型2-网约车归档延期默认类型可以不传")
    @PostMapping(value = "/S22001/delay/new")
    @AfsFeignClear(true)
    ArchivedResultDto newDelay(@RequestBody DelayDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 编辑(查看) 延期申请id
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("编辑(查看) 延期申请id")
    @PostMapping(value = "/S22001/delay/look")
    @AfsFeignClear(true)
    ArchivedResultDto lookDelay(@RequestBody DelayDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 删除草稿状态的延期申请
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("删除草稿状态的延期申请")
    @PostMapping(value = "/S22001/delay/delete")
    @AfsFeignClear(true)
    ArchivedResultDto deleteDelay(@RequestBody DelayDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 获取归档列表
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("获取归档列表")
    @PostMapping(value = "/S22001/doc/getlist")
    @AfsFeignClear(true)
    ArchivedResultDto getDocList(@RequestBody DocumentDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 编辑查看归档信息
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("编辑查看归档信息")
    @PostMapping(value = "/S22001/doc/edit")
    @AfsFeignClear(true)
    ArchivedResultDto editDocInfo(@RequestBody DocumentDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 提交归档信息，贷后信息，归档清单
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("提交归档信息，贷后信息，归档清单")
    @PostMapping(value = "/S22001/doc/submit")
    @AfsFeignClear(true)
    ArchivedResultDto submitDocInfo(@RequestBody DocumentDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 银行卡/身份证打印接口
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("银行卡/身份证打印接口")
    @PostMapping(value = "/S22001/doc/getimpmd5")
    @AfsFeignClear(true)
    ArchivedResultDto printDocPicture(@RequestBody DocumentDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 删除邮寄的归档数据
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("删除邮寄列表信息")
    @PostMapping(value = "/S22001/postfile/del")
    @AfsFeignClear(true)
    ArchivedResultDto deletePostDocInfo(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 查询邮寄的归档列表
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("获取邮寄列表信息")
    @PostMapping(value = "/S22001/postfile/getlist")
    @AfsFeignClear(true)
    ArchivedResultDto getPostDocList(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 判断是否免抵押退回绿本
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("判断是否免抵押退回绿本")
    @PostMapping(value = "/S22001/postfile/check")
    @AfsFeignClear(true)
    ArchivedResultDto checkPostDoc(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 创建运单信息
     *
     * @param headers
     * @return
     */
    @ApiOperation("创建运单信息 运单id")
    @PostMapping(value = "/S22001/post/new")
    @AfsFeignClear(true)
    ArchivedResultDto newPost(@RequestHeader Map<String, String> headers);

    /**
     * 保存运单信息
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("保存运单信息")
    @PostMapping(value = "/S22001/post/save")
    @AfsFeignClear(true)
    ArchivedResultDto savePost(@RequestBody JSONObject dto, @RequestHeader Map<String, String> headers);

    /**
     * 查找最新运单
     *
     * @param headers
     * @return
     */
    @ApiOperation("查找最新运单")
    @PostMapping(value = "/S22001/post/lastpost")
    @AfsFeignClear(true)
    ArchivedResultDto getLastPost(@RequestHeader Map<String, String> headers);

    /**
     * 编辑运单信息
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("编辑运单信息")
    @PostMapping(value = "/S22001/post/edit")
    @AfsFeignClear(true)
    ArchivedResultDto editPost(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 提交运单信息
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("提交运单信息")
    @PostMapping(value = "/S22001/post/submit")
    @AfsFeignClear(true)
    ArchivedResultDto submitPost(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);


    /**
     * 档案系统用到的各种数据字典的接口
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("档案系统用到的各种数据字典的接口")
    @PostMapping(value = "/S22001/common/getcodes")
    @AfsFeignClear(true)
    ArchivedResultDto getcodes(@RequestBody MoreProducttDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 多品获取邮单详情
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("多品获取邮单详情")
    @PostMapping(value = "/S22001/post/getdetail")
    @AfsFeignClear(true)
    ArchivedResultDto getdetail(@RequestBody MoreProducttDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 多品获取邮单列表
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("多品获取邮单列表")
    @PostMapping(value = "/S22001/post/getlist")
    @AfsFeignClear(true)
    ArchivedResultDto getlist(@RequestBody MoreProducttDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 多品归档编辑和查看页面
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("多品归档编辑和查看页面")
    @PostMapping(value = "/S22001/doc/editview")
    @AfsFeignClear(true)
    ArchivedResultDto editview(@RequestBody MoreProducttDto dto, @RequestHeader Map<String, String> headers);

    /**
     * @Description:文件上传
     * @Author: yaorui.zhang
     * @Date: 2020年8月4日 20:55:43
     * @Param:md5,sceneid,randomstr,file,headers
     * @Return
     */
    @ApiOperation("文件上传")
    @PostMapping(value = "/S120017/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @AfsFeignClear(true)
    ArchivedResultDto upload(@RequestParam("sceneid") String sceneid, @RequestParam("randomstr") String randomstr, @RequestPart("file") MultipartFile file, @RequestHeader Map<String, String> headers);

    /**
     * @Description:文件下载
     * @Author: yaorui.zhang
     * @Date: 2020年8月4日 20:57:57
     * @Param: [md5, sceneid]
     * @Return
     */
    @ApiOperation("文件下载")
    @PostMapping(value = "/S120017/download")
    @AfsFeignClear(true)
    byte[] downFile(@RequestBody JSONObject json, @RequestHeader Map<String, String> headers);

    /**
     * 从fms库删除影像件
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("从fms库删除影像件")
    @PostMapping(value = "/S22001/order/delImageFms")
    @AfsFeignClear(true)
    JSONObject delImageFormFms(@RequestBody JSONObject json, @RequestHeader Map<String, String> headers);

    /**
     * 影像件上次后保存业务数据
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("影像件上次后保存业务数据")
    @PostMapping(value = "/S22001/img/dcsaveinfo")
    @AfsFeignClear(true)
    ArchivedResultDto dcsaveinfo(@RequestBody ImageDto dto, @RequestHeader Map<String, String> headers);

    /**
     * 获取挂靠信息
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("获取挂靠信息")
    @PostMapping(value = "/S22001/anchoerd/getanchoredinfo")
    @AfsFeignClear(true)
    ArchivedResultDto getanchoredinfo(@RequestBody PostDto dto, @RequestHeader Map<String, String> headers);

    @ApiOperation("结清邮寄查询")
    @PostMapping(value = "/S22001/afterloan/settleexpress")
    @AfsFeignClear(true)
    JSONObject settleExpress(@RequestBody JSONObject json, @RequestHeader Map<String, String> headers);
}
